{% extends "activity/nav.html" %}
{% block title %}HCP - Activity{% endblock %}

{% block torso %}
<!-- MEDIA include datatable -->

<table class="yui-dt">
  <thead>
    <tr class="yui-dt-first yui-dt-last">
      <th>Username</th>
      <th>Date</th>
      <th>Changes</th>
    </tr>
  </thead>
  <tbody>
    {% for mod, objs in data %}
    <tr>
      <td>mod.username</td>
      <td>mod.timestamp</td>
      <td>
        <table>
          <thead>
            <tr>
              <th>Type</th>
              <th>Action</th>
              <th>DN</th>
              <th>Changes</th>
            </tr>
          </thead>
          <tbody class="yui-dt-data">
            {% for obj, attrs in objs %}
            <tr>
              <td>{{ obj.object_type }}</td>
              <td>{{ obj.action }}</td>
              <td>{{ obj.dn }}</td>
              <td>
                <table>
                  <thead>
                    <tr>
                      <th>Attribute</th>
                      <th>Change</th>
                      <th>Old Values</th>
                      <th>New Values</th>
                    </tr>
                  </thead>
                  {% for attr, old_values, new_values in attrs %}
                  <tr>
                    <td>{{ attr.attribute_name }}</td>
                    <td>{{ attr.op }}</td>
                    <td>
                      <ul>
                      {% for old in old_values %}
                        <li>{{ old.value }}</li>
                      {% endfor %}
                      </ul>
                    </td>
                    <td>
                      <ul>
                      {% for new in new_values %}
                        <li>{{ new.value }}</li>
                      {% endfor %}
                      </ul>
                    </td>
                  </tr>
                  {% endfor %}
                </table>
              </td>
            </tr>
            {% endfor %}
          </tbody>
        </table>
    {% endfor %}
  </tbody>
</table>
{% endblock %}


